It might be a database ...
It might be a database ...
am 14.01.2005 03:43:03 von MilesArcher
Okay guys and gals,
MS communities has never let me down ...
I'm not certain which group to post this to, so direct me to the correct on
please. I am not cross-posting.
I have 200+ PDF files, they have matching HTML files, and they have matching
text files.
I just want a description, document number, and links to the three files
(times 200 ...) In table format, or any easily readable format, then included
on an HTML page for users to select the document and format of their choice.
Doc# | Description |PDF |HTML|TEXT
_______________________________
001 | Dead P.I.'s | X | X | X
_______________________________
You get the picture ...
What do I need to automate this process as much as possible?
Thanks so much,
Miles
--
Posted from
http://communities2.microsoft.com/communities/newsgroups/en- us/default.aspx
Re: It might be a database ...
am 14.01.2005 04:57:33 von Roland Hall
"Miles Archer" wrote in message
news:77205A31-BF7A-4070-993D-7EC1A328AECA@microsoft.com...
: Okay guys and gals,
: MS communities has never let me down ...
:
: I'm not certain which group to post this to, so direct me to the correct
on
: please. I am not cross-posting.
:
: I have 200+ PDF files, they have matching HTML files, and they have
matching
: text files.
:
: I just want a description, document number, and links to the three files
: (times 200 ...) In table format, or any easily readable format, then
included
: on an HTML page for users to select the document and format of their
choice.
:
: Doc# | Description |PDF |HTML|TEXT
: _______________________________
: 001 | Dead P.I.'s | X | X | X
: _______________________________
:
: You get the picture ...
:
: What do I need to automate this process as much as possible?
Are you asking to automate the gathering of the file names from the drive
and then populate the page?
--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp
Re: It might be a database ...
am 14.01.2005 05:04:14 von unknown
Where do the files exist? Are they just all sitting in a directory on the
server? Or are they at various locations but cataloged in a database with
the names and paths? Where do you have the description data stored? In
this same database? What kind of database is it? What's the layout of the
relevant data in the database?
Ray at home
"Miles Archer" wrote in message
news:77205A31-BF7A-4070-993D-7EC1A328AECA@microsoft.com...
> Okay guys and gals,
> MS communities has never let me down ...
>
> I'm not certain which group to post this to, so direct me to the correct
> on
> please. I am not cross-posting.
>
> I have 200+ PDF files, they have matching HTML files, and they have
> matching
> text files.
>
> I just want a description, document number, and links to the three files
> (times 200 ...) In table format, or any easily readable format, then
> included
> on an HTML page for users to select the document and format of their
> choice.
>
> Doc# | Description |PDF |HTML|TEXT
> _______________________________
> 001 | Dead P.I.'s | X | X | X
> _______________________________
>
> You get the picture ...
>
> What do I need to automate this process as much as possible?
>
> Thanks so much,
> Miles
> --
> Posted from
> http://communities2.microsoft.com/communities/newsgroups/en- us/default.aspx
Re: It might be a database ...
am 14.01.2005 05:39:03 von MilesArcher
"Roland Hall" wrote:
> Are you asking to automate the gathering of the file names from the drive
> and then populate the page?
>
> --
> Roland Hall
I'm willing to do whatever I need to do to keep from entering them all by
hand.
Right now they are just in a directory. I can load them into FP 2002, I can
load them up to a Unix server. I have ASP, PHP, MySQL, PostgreSQL, I can use
Access (but I am Access impared ... ). I suppose I could get ShareTeam, but I
think that would be hitting an ant with a sledge hammer. I can use IIS.
But, yes, I want to list the files, add a description and then populate a
page with links.
Re: It might be a database ...
am 14.01.2005 06:55:01 von MilesArcher
They are just files on a server.
I haven't created a database yet because I wasn't convinced it was the best
route to take to accomplish my goal. (except maybe a flat file)
Even after I created a db, I still would have to make it display on an HTML
page, which I have no idea how to do.
I can go out and find dozens of free templates to create complex community
discussion boards (phpBB, etc.), but I couldn't locate any templates/scripts
that would list files, except ones that output something akin to a Unix
directory (i.e no comments).
Thanks.
"Ray Costanzo [MVP]" wrote:
> Where do the files exist? Are they just all sitting in a directory on the
> server? Or are they at various locations but cataloged in a database with
> the names and paths? Where do you have the description data stored? In
> this same database? What kind of database is it? What's the layout of the
> relevant data in the database?
>
> Ray at home
Re: It might be a database ...
am 14.01.2005 12:09:31 von McKirahan
"Miles Archer" wrote in message
news:77205A31-BF7A-4070-993D-7EC1A328AECA@microsoft.com...
> Okay guys and gals,
> MS communities has never let me down ...
>
> I'm not certain which group to post this to, so direct me to the correct
on
> please. I am not cross-posting.
>
> I have 200+ PDF files, they have matching HTML files, and they have
matching
> text files.
>
> I just want a description, document number, and links to the three files
> (times 200 ...) In table format, or any easily readable format, then
included
> on an HTML page for users to select the document and format of their
choice.
>
> Doc# | Description |PDF |HTML|TEXT
> _______________________________
> 001 | Dead P.I.'s | X | X | X
> _______________________________
>
> You get the picture ...
>
> What do I need to automate this process as much as possible?
>
> Thanks so much,
> Miles
Please give us more information.
Are the files all in the same folder?
Are the files in folder(s) under the web root folder? If so, waht is the
path?
Is there a naming convention to the files? If so, what is it?
Do the descriptions already exist?
Perhaps as the first line in the corresponding text files?
If not, can you create a text file that identifies each?
Apparently you want the list in order by "Doc#"; does that relate to file
name in any way?
Will the nunber of files change; if so, how many and how frequently?
You probably don't need a database...
Let's say:
1) you have the files in a folder call PDF under the page that the Web
page is.
2) that all files start with "Doc#" followed by 3 digits followed by
".htm", "pdf", or ".txt".
3) that you have a file ("Doc#.txt") that contains the descriptions of
all of the files.
4) that the layout of this file is "file prefix" followed by "=" followed
by "description";
for example, "Doc#001=Dead P.I.'s" or "001=Dead P.I.'s".
Do you want a solution for the above requirements?
Re: It might be a database ...
am 14.01.2005 13:54:57 von Roland Hall
"Miles Archer" wrote in message
news:169E6471-BDA9-442C-AEEE-2071BB4DB533@microsoft.com...
: "Roland Hall" wrote:
:
: > Are you asking to automate the gathering of the file names from the
drive
: > and then populate the page?
: >
: > --
: > Roland Hall
:
: I'm willing to do whatever I need to do to keep from entering them all by
: hand.
:
: Right now they are just in a directory. I can load them into FP 2002, I
can
: load them up to a Unix server. I have ASP, PHP, MySQL, PostgreSQL, I can
use
: Access (but I am Access impared ... ). I suppose I could get ShareTeam,
but I
: think that would be hitting an ant with a sledge hammer. I can use IIS.
:
: But, yes, I want to list the files, add a description and then populate a
: page with links.
something like this?
http://kiddanger.com/lab/filelist.asp
It gathers all the .txt files in the same directory only, since you said
there are 3 of each (html, pdf, txt) but strips off the file extension. It
opens a .txt file with a list of the file descriptions, puts that into an
array, then filters this array based upon the prefix of the filename. It
then loops through each file in the array and writes the file prefix,
description, and three links for the file with the 3 extensions.
It won't matter how many files you have but the filename should be unique
enough so that they do not duplicate in the file descriptions, otherwise, I
would store the file name prefix in the list with the description so you
know which description to assign to which file without error.
No database is involved. It's not pretty but cosmetics usually come last.
HTH...
--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp
Re: It might be a database ...
am 14.01.2005 14:15:28 von McKirahan
"McKirahan" wrote in message
news:NPSdnUBJiJKGNXrcRVn-3A@comcast.com...
> "Miles Archer" wrote in message
> news:77205A31-BF7A-4070-993D-7EC1A328AECA@microsoft.com...
> > Okay guys and gals,
> > MS communities has never let me down ...
> >
> > I'm not certain which group to post this to, so direct me to the correct
> on
> > please. I am not cross-posting.
> >
> > I have 200+ PDF files, they have matching HTML files, and they have
> matching
> > text files.
> >
> > I just want a description, document number, and links to the three files
> > (times 200 ...) In table format, or any easily readable format, then
> included
> > on an HTML page for users to select the document and format of their
> choice.
> >
> > Doc# | Description |PDF |HTML|TEXT
> > _______________________________
> > 001 | Dead P.I.'s | X | X | X
> > _______________________________
> >
> > You get the picture ...
> >
> > What do I need to automate this process as much as possible?
> >
> > Thanks so much,
> > Miles
[snip]
Using a "Doc#.txt" file like:
Doc=Description
---------------
001=One
002=Two
003=Three
004=Four
005=Five
006=Six
007=Seven
008=Eight
009=Nine
The following "Doc#.vbs" script generates "Doc#.htm" which is an HTML table
that can be inserted into your Web page. Regenerate it then cut-and-paste
it each time the list of documents change.
Modify the Constanst "cFOL" to point to the subfolder that the files are in.
If the folder doesn't exist then the script exits.
If a file doesn't exist then it's table column will be blank.
Watch for word-wrap.
Option Explicit
'*
'* Declare Constants
'*
Const cVBS = "Doc#.vbs"
Const cTXT = "Doc#.txt"
Const cHTM = "Doc#.htm"
Const cFOL = "files\"
'*
'* Declare Variables
'*
Dim arrBGC(1)
arrBGC(0) = "#FFFFFF"
arrBGC(1) = "#EEEEEE"
Dim arrDOC
Dim intDOC
intDOC = 0
Dim strDOC
Dim arrEXT(2)
arrEXT(0) = ".pdf"
arrEXT(1) = ".htm"
arrEXT(2) = ".txt"
Dim intEXT
Dim strHTM
Dim strOTF
Dim arrSTR()
ReDim arrSTR(100)
Dim intSTR
intSTR = 0
Dim strSTR
Dim arrTXT
Dim intTXT
Dim strTXT
'*
'* Declare Objects
'*
Dim objFSO
Set objFSO = CreateObject("Scripting.FileSystemObject")
If Not objFSO.FolderExists(cFOL) Then WScript.Quit
Dim objOTF
'*
'* Read File
'*
Set objOTF = objFSO.OpenTextFile(cTXT,1)
strOTF = objOTF.ReadAll()
Set objOTF = Nothing
'*
'* Build Table
'*
Append "
style='border:1px solid black'>"
Append ""
Append " Doc#
| "
Append " Description
| "
Append " PDF
| "
Append " HTML
| "
Append " TEXT
| "
Append "
"
arrTXT = Split(strOTF,vbCrLf)
For intTXT = 0 To UBound(arrTXT)
strTXT = arrTXT(intTXT)
If IsNumeric(Left(strTXT,3)) Then
intDOC = intDOC + 1
arrDOC = Split(strTXT,"=")
Append ""
Append " " & arrDOC(0) & " | "
Append " " & arrDOC(1) & " | "
For intEXT = 0 To UBound(arrEXT)
strDOC = "Doc#" & arrDOC(0) & arrEXT(intEXT)
strHTM = ""
If objFSO.FileExists(cFOL & strDOC) Then
strHTM = "
target='_blank'>" & strDOC & ""
End If
Append " " & strHTM & " | "
Next
Append "
"
End If
Next
Append ""
'*
'* Write File
'*
strOTF = Concat()
Set objOTF = objFSO.OpenTextFile(cHTM,2,true)
objOTF.Write(strOTF)
Set objOTF = Nothing
'*
'* Destroy Objects
'*
Set objFSO = Nothing
'*
'* Finish
'*
MsgBox intDOC & " Doc#",vbInformation,cVBS
Sub Append(strSTR)
'*
'* Appends strings to array entries redimensioning as needed; (see
"Concat()").
'*
strSTR = strSTR & ""
If intSTR > UBound(arrSTR) Then
ReDim Preserve arrSTR(UBound(arrSTR) + 100)
End If
arrSTR(intSTR) = strSTR & vbCrLf
intSTR = intSTR + 1
End Sub
Function Concat()
'*
'* Concatenates array entries into a single string; (see "Append()").
'*
Redim Preserve arrSTR(intSTR)
Concat = Join(arrSTR, "")
Erase arrSTR
ReDim arrSTR(100)
intSTR = 0
End Function
Re: It might be a database ...
am 14.01.2005 14:21:01 von MilesArcher
"McKirahan" wrote:
> "Miles Archer" wrote in message
> news:77205A31-BF7A-4070-993D-7EC1A328AECA@microsoft.com...
> > Okay guys and gals,
> > MS communities has never let me down ...
> >
> > I'm not certain which group to post this to, so direct me to the correct
> > on please. I am not cross-posting.
> >
> > I have 200+ PDF files, they have matching HTML files, and they have
> > matching text files.
> >
> > I just want a description, document number, and links to the three files
> > (times 200 ...) In table format, or any easily readable format, then
> > included
> > on an HTML page for users to select the document and format of their
> > choice.
> >
> > Doc# | Description |PDF |HTML|TEXT
> > _______________________________
> > 001 | Dead P.I.'s | X | X | X
> > _______________________________
> >
> > You get the picture ...
> >
> > What do I need to automate this process as much as possible?
> >
> > Thanks so much,
> > Miles
>
> Please give us more information.
Sorry. I wasn't certain what info you would need.
> Are the files all in the same folder?
They are under a folder named 'documents', then the files are in a folder
that identifies them "98-5643", "04-9876", etc. Each folder has a matching
PDF and text file within that folder. ("98-5634.PDF", and "98-5634.TXT", etc.
) The HTML pages are a little more complex. They are in the appropriate
folders, but each one has multiple pages. index.html is set up as a frames
page with navigation frames. Index.html has the document name as the
Document Name and the meta-tag description is the documents
"preview description". It would be difficult to put all the HTML pages under
the same folder because they all contain "index.html", "page_001.html", etc.
> Are the files in folder(s) under the web root folder? If so, waht is the
> path?
I can put them there, and I can alias the path on the server. On Unix it
would be var/www/document on Windows it would be C:\ or using Inetpub it
would be C:\Inetpub\wwwroot. I would prefer to use the Unix, but I am
flexible.
> Is there a naming convention to the files? If so, what is it?
It varies. Some are the 2 digit year followed with 4 numbers, some have an
internal naming convention using alpha numeric names.
> Do the descriptions already exist?
> Perhaps as the first line in the corresponding text files?
> If not, can you create a text file that identifies each?
It would not be a problem to create text files that contain the information.
Mostly a copy & paste operation.
> Apparently you want the list in order by "Doc#"; does that relate to file
> name in any way?
Yes, I believe you will see that when you read what I have already written.
> Will the nunber of files change; if so, how many and how frequently?
The files will be added to at about 20 a month.
> You probably don't need a database...
I didn't thik so, but I wasn't sure. (Hence the name of my post)
> Let's say:
>
> 1) you have the files in a folder call PDF under the page that the Web
> page is.
>
> 2) that all files start with "Doc#" followed by 3 digits followed by
> ".htm", "pdf", or ".txt".
The HTML pages break this convention. I could rename the index.html for
each one to the document number.html if I needed to.
> 3) that you have a file ("Doc#.txt") that contains the descriptions of
> all of the files.
The Doc#.txt would need to be diffferent since the actual text file of the
document already has that name taken. I could use "Doc#-2.txt" or
"Doc#info.txt", or some such convention.
> 4) that the layout of this file is "file prefix" followed by "=" followed
> by "description";
> for example, "Doc#001=Dead P.I.'s" or "001=Dead P.I.'s".
"001=Dead P.I.'s" would be the most correct.
> Do you want a solution for the above requirements?
Unless my folder situation has thrown a monkey wrench into it, yes please.
I thank you for your time.
Re: It might be a database ...
am 14.01.2005 14:21:43 von McKirahan
[snip]
I forgot that you posted your question in an ASP group.
You don't have to cut-and-paste the table when the list of documents change.
Just put my script in your ASP page and:
1) change "CreateObject()" to "Server.CreateObject()"
2) remove the "Write File" logic
3) insert <%=Concat()%> in your page where you want the table
4) remove the "MsgBox" and the "cVBS" and "cHTM" contsants.
Re: It might be a database ...
am 14.01.2005 14:29:03 von MilesArcher
I will give this a try and see if it works for me.
I haven't worked much with VBS, but if I can manage machine code and
binary-encoded hexadecimal I should be able to slash away at this short code.
I'm always up for a challange ... :-)
Is there a repository of VBScripts, or do you have to wing this stuff?
I sincerely thank you for your time and will post back.
"McKirahan" wrote:
> "McKirahan" wrote in message
> news:NPSdnUBJiJKGNXrcRVn-3A@comcast.com...
> > "Miles Archer" wrote in message
> > news:77205A31-BF7A-4070-993D-7EC1A328AECA@microsoft.com...
> > > Okay guys and gals,
> > > MS communities has never let me down ...
> > >
> > > I'm not certain which group to post this to, so direct me to the correct
> > on
> > > please. I am not cross-posting.
> > >
> > > I have 200+ PDF files, they have matching HTML files, and they have
> > matching
> > > text files.
> > >
> > > I just want a description, document number, and links to the three files
> > > (times 200 ...) In table format, or any easily readable format, then
> > included
> > > on an HTML page for users to select the document and format of their
> > choice.
> > >
> > > Doc# | Description |PDF |HTML|TEXT
> > > _______________________________
> > > 001 | Dead P.I.'s | X | X | X
> > > _______________________________
> > >
> > > You get the picture ...
> > >
> > > What do I need to automate this process as much as possible?
> > >
> > > Thanks so much,
> > > Miles
>
> [snip]
>
> Using a "Doc#.txt" file like:
>
> Doc=Description
> ---------------
> 001=One
> 002=Two
> 003=Three
> 004=Four
> 005=Five
> 006=Six
> 007=Seven
> 008=Eight
> 009=Nine
>
> The following "Doc#.vbs" script generates "Doc#.htm" which is an HTML table
> that can be inserted into your Web page. Regenerate it then cut-and-paste
> it each time the list of documents change.
>
> Modify the Constanst "cFOL" to point to the subfolder that the files are in.
>
> If the folder doesn't exist then the script exits.
>
> If a file doesn't exist then it's table column will be blank.
>
> Watch for word-wrap.
>
> Option Explicit
> '*
> '* Declare Constants
> '*
> Const cVBS = "Doc#.vbs"
> Const cTXT = "Doc#.txt"
> Const cHTM = "Doc#.htm"
> Const cFOL = "files\"
> '*
> '* Declare Variables
> '*
> Dim arrBGC(1)
> arrBGC(0) = "#FFFFFF"
> arrBGC(1) = "#EEEEEE"
> Dim arrDOC
> Dim intDOC
> intDOC = 0
> Dim strDOC
> Dim arrEXT(2)
> arrEXT(0) = ".pdf"
> arrEXT(1) = ".htm"
> arrEXT(2) = ".txt"
> Dim intEXT
> Dim strHTM
> Dim strOTF
> Dim arrSTR()
> ReDim arrSTR(100)
> Dim intSTR
> intSTR = 0
> Dim strSTR
> Dim arrTXT
> Dim intTXT
> Dim strTXT
> '*
> '* Declare Objects
> '*
> Dim objFSO
> Set objFSO = CreateObject("Scripting.FileSystemObject")
> If Not objFSO.FolderExists(cFOL) Then WScript.Quit
> Dim objOTF
> '*
> '* Read File
> '*
> Set objOTF = objFSO.OpenTextFile(cTXT,1)
> strOTF = objOTF.ReadAll()
> Set objOTF = Nothing
> '*
> '* Build Table
> '*
> Append "
> style='border:1px solid black'>"
> Append ""
> Append " Doc#
| "
> Append " Description
| "
> Append " PDF
| "
> Append " HTML
| "
> Append " TEXT
| "
> Append "
"
> arrTXT = Split(strOTF,vbCrLf)
> For intTXT = 0 To UBound(arrTXT)
> strTXT = arrTXT(intTXT)
> If IsNumeric(Left(strTXT,3)) Then
> intDOC = intDOC + 1
> arrDOC = Split(strTXT,"=")
> Append ""
> Append " " & arrDOC(0) & " | "
> Append " " & arrDOC(1) & " | "
> For intEXT = 0 To UBound(arrEXT)
> strDOC = "Doc#" & arrDOC(0) & arrEXT(intEXT)
> strHTM = ""
> If objFSO.FileExists(cFOL & strDOC) Then
> strHTM = "
> target='_blank'>" & strDOC & ""
> End If
> Append " " & strHTM & " | "
> Next
> Append "
"
> End If
> Next
> Append ""
> '*
> '* Write File
> '*
> strOTF = Concat()
> Set objOTF = objFSO.OpenTextFile(cHTM,2,true)
> objOTF.Write(strOTF)
> Set objOTF = Nothing
> '*
> '* Destroy Objects
> '*
> Set objFSO = Nothing
> '*
> '* Finish
> '*
> MsgBox intDOC & " Doc#",vbInformation,cVBS
>
> Sub Append(strSTR)
> '*
> '* Appends strings to array entries redimensioning as needed; (see
> "Concat()").
> '*
> strSTR = strSTR & ""
> If intSTR > UBound(arrSTR) Then
> ReDim Preserve arrSTR(UBound(arrSTR) + 100)
> End If
> arrSTR(intSTR) = strSTR & vbCrLf
> intSTR = intSTR + 1
> End Sub
>
> Function Concat()
> '*
> '* Concatenates array entries into a single string; (see "Append()").
> '*
> Redim Preserve arrSTR(intSTR)
> Concat = Join(arrSTR, "")
> Erase arrSTR
> ReDim arrSTR(100)
> intSTR = 0
> End Function
>
>
>
Re: It might be a database ...
am 14.01.2005 14:36:24 von McKirahan
"Miles Archer" wrote in message
news:2E45CACC-6D3B-4EBF-9F09-0AD30D9C0DD4@microsoft.com...
[snip]
A few questions...
> Sorry. I wasn't certain what info you would need.
>
> > Are the files all in the same folder?
>
> They are under a folder named 'documents', then the files are in a folder
> that identifies them "98-5643", "04-9876", etc. Each folder has a
matching
> PDF and text file within that folder. ("98-5634.PDF", and "98-5634.TXT",
etc.
> ) The HTML pages are a little more complex. They are in the appropriate
> folders, but each one has multiple pages. index.html is set up as a frames
> page with navigation frames. Index.html has the document name as the
> Document Name and the meta-tag description is the documents
> "preview description". It would be difficult to put all the HTML pages
under
> the same folder because they all contain "index.html", "page_001.html",
etc.
>
> > Are the files in folder(s) under the web root folder? If so, waht is
the
> > path?
>
> I can put them there, and I can alias the path on the server. On Unix it
> would be var/www/document on Windows it would be C:\ or using Inetpub it
> would be C:\Inetpub\wwwroot. I would prefer to use the Unix, but I am
> flexible.
>
> > Is there a naming convention to the files? If so, what is it?
>
> It varies. Some are the 2 digit year followed with 4 numbers, some have an
> internal naming convention using alpha numeric names.
>
Given the above, do the following exist?
c:\inetpub\wwwroot\documents\98-5634.PDF
c:\inetpub\wwwroot\documents\98-5634.TXT
c:\inetpub\wwwroot\documents\98-5634\index.html
Is the Description you want the from each "index.html"?
Is the "Doc#" column is a sequential number (001, 002, etc.) and not the
document's fileame prefix? If the latter then what order do you want the
filenames to be listed: alphabetically, by date, or?
Re: It might be a database ...
am 14.01.2005 14:39:13 von MilesArcher
I will take a loook at it directly. I've been up all night, but I still have
a bit of steam.
I thank you for your time.
"Roland Hall" wrote:
> "Miles Archer" wrote in message
> news:169E6471-BDA9-442C-AEEE-2071BB4DB533@microsoft.com...
> : "Roland Hall" wrote:
> :
> : > Are you asking to automate the gathering of the file names from the
> drive
> : > and then populate the page?
> : >
> : > --
> : > Roland Hall
> :
> : I'm willing to do whatever I need to do to keep from entering them all by
> : hand.
> :
> : Right now they are just in a directory. I can load them into FP 2002, I
> can
> : load them up to a Unix server. I have ASP, PHP, MySQL, PostgreSQL, I can
> use
> : Access (but I am Access impared ... ). I suppose I could get ShareTeam,
> but I
> : think that would be hitting an ant with a sledge hammer. I can use IIS.
> :
> : But, yes, I want to list the files, add a description and then populate a
> : page with links.
>
> something like this?
> http://kiddanger.com/lab/filelist.asp
>
> It gathers all the .txt files in the same directory only, since you said
> there are 3 of each (html, pdf, txt) but strips off the file extension. It
> opens a .txt file with a list of the file descriptions, puts that into an
> array, then filters this array based upon the prefix of the filename. It
> then loops through each file in the array and writes the file prefix,
> description, and three links for the file with the 3 extensions.
>
> It won't matter how many files you have but the filename should be unique
> enough so that they do not duplicate in the file descriptions, otherwise, I
> would store the file name prefix in the list with the description so you
> know which description to assign to which file without error.
>
> No database is involved. It's not pretty but cosmetics usually come last.
>
> HTH...
>
> --
> Roland Hall
> /* This information is distributed in the hope that it will be useful, but
> without any warranty; without even the implied warranty of merchantability
> or fitness for a particular purpose. */
> Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
> WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
> MSDN Library - http://msdn.microsoft.com/library/default.asp
>
>
>
Re: It might be a database ...
am 14.01.2005 14:45:03 von MilesArcher
"Roland Hall" wrote:
> something like this?
> http://kiddanger.com/lab/filelist.asp
>
> It gathers all the .txt files in the same directory only, since you said
> there are 3 of each (html, pdf, txt) but strips off the file extension. It
> opens a .txt file with a list of the file descriptions, puts that into an
> array, then filters this array based upon the prefix of the filename. It
> then loops through each file in the array and writes the file prefix,
> description, and three links for the file with the 3 extensions.
>
> It won't matter how many files you have but the filename should be unique
> enough so that they do not duplicate in the file descriptions, otherwise, I
> would store the file name prefix in the list with the description so you
> know which description to assign to which file without error.
>
> No database is involved. It's not pretty but cosmetics usually come last.
>
> HTH...
>
> --
> Roland Hall
Yes, it looks like that would work. How did you generate it?
Re: It might be a database ...
am 14.01.2005 15:05:06 von MilesArcher
"McKirahan" wrote:
> "Miles Archer" wrote in message
> news:2E45CACC-6D3B-4EBF-9F09-0AD30D9C0DD4@microsoft.com...
>
> [snip]
>
> Given the above, do the following exist?
>
> c:\inetpub\wwwroot\documents\98-5634.PDF
> c:\inetpub\wwwroot\documents\98-5634.TXT
> c:\inetpub\wwwroot\documents\98-5634\index.html
Yes. That is the way they exist.
> Is the Description you want the from each "index.html"?
Well.. the is the name of the document, while the description is a
two sentence summary contained at I
may have to do away with the description since it would be too large to put
in a table, unless I used really a small font or had it link to a new
description page. (A mouseover might work... I'll ahve to look into that
next.)
> Is the "Doc#" column is a sequential number (001, 002, etc.) and not the
> document's fileame prefix? If the latter then what order do you want the
> filenames to be listed: alphabetically, by date, or?
>
No, the Doc# is the filename's prefix. They are not sequential except for
small runs.
Alphabetical by filename prefix would be great.
I really do appreciate all the time you are giving me.
Re: It might be a database ...
am 14.01.2005 16:20:59 von McKirahan
"Miles Archer" wrote in message
news:30C0FB09-1168-4114-AA47-363AD6F763E9@microsoft.com...
> "McKirahan" wrote:
>
> > "Miles Archer" wrote in message
> > news:2E45CACC-6D3B-4EBF-9F09-0AD30D9C0DD4@microsoft.com...
> >
> > [snip]
>
> >
> > Given the above, do the following exist?
> >
> > c:\inetpub\wwwroot\documents\98-5634.PDF
> > c:\inetpub\wwwroot\documents\98-5634.TXT
> > c:\inetpub\wwwroot\documents\98-5634\index.html
>
> Yes. That is the way they exist.
>
>
> > Is the Description you want the from each "index.html"?
>
> Well.. the is the name of the document, while the description is a
> two sentence summary contained at
content="fubar"> I
> may have to do away with the description since it would be too large to
put
> in a table, unless I used really a small font or had it link to a new
> description page. (A mouseover might work... I'll ahve to look into that
> next.)
>
> > Is the "Doc#" column is a sequential number (001, 002, etc.) and not the
> > document's fileame prefix? If the latter then what order do you want
the
> > filenames to be listed: alphabetically, by date, or?
> >
>
> No, the Doc# is the filename's prefix. They are not sequential except for
> small runs.
> Alphabetical by filename prefix would be great.
>
> I really do appreciate all the time you are giving me.
Try this and let me know. Watch for word-wrap.
No file with the descriptions is need.
<% @Language="VBScript"
'*
'* This ASP (Active Server Page) does the following:
'* 1) Determines if folder "cFOL" exists.
'* 2) Extracts the names of all PDF files in this folder.
'* 3) Sort the PDF file names.
'* 4) For each PDF file name build a row in an HTML table.
'* 5) Displays this table in a Web page.
'*
'* The following is expected under "c:\wwwroot\inetpub\""
'* 1) \documents\#.pdf
'* 2) \documents\#.txt
'* 3) \documents\#\index.html (meta tag contains description)
'*
'* Each row will contain a hyperlinked "X" if the file exists.
'*
Option Explicit
'*
'* Declare Constants
'*
Const cASP = "Doc.asp"
Const cFOL = "documents\"
Const cRST = "Doc"
'*
Const adChar = 129
Const adLockBatchOptimistic = 4
Const adOpenStatic = 3
Const adUseClient = 3
'*
'* Declare Variables
'*
Dim arrBGC(1)
arrBGC(0) = "#FFFFFF"
arrBGC(1) = "#EEEEEE"
Dim arrDOC
Dim intDOC
intDOC = 0
Dim strDOC
Dim intDSC
Dim strDSC
Dim strFIL
Dim strHTM
Dim strLNK
Dim strOTF
Dim strPRE
Dim intRST
Dim strRST
Dim arrSTR()
ReDim arrSTR(100)
Dim intSTR
intSTR = 0
Dim strSTR
Dim strTAG
strTAG = "
strTAG = Replace(strTAG,"`",Chr(34))
Dim strTXT
Dim strWWW
strWWW = Request.ServerVariables("PATH_TRANSLATED")
strWWW = Left(strWWW,InStrRev(strWWW,"\"))
'*
'* Declare Objects
'*
Dim objFSO
Set objFSO = CreateObject("Scripting.FileSystemObject")
If Not objFSO.FolderExists(strWWW & cFOL) Then Response.End
Dim objGFO
Dim objOTF
Dim objRST
Set objRST = CreateObject("ADODB.RecordSet")
objRST.CursorLocation = adUseClient
objRST.LockType = adLockBatchOptimistic
objRST.CursorType = adOpenStatic
objRST.ActiveConnection = Nothing
objRST.Fields.Append cRST, adChar, 255
objRST.Open
'*
'* Read File
'*
Set objGFO = objFSO.GetFolder(strWWW & cFOL)
For Each strFIL in objGFO.Files
If LCase(Right(strFIL.Name,4)) = ".pdf" Then
objRST.AddNew
objRST.Fields(cRST) = strFIL.Name
objRST.Update
End If
Next
Set objGFO = Nothing
'*
'* Sort RecordSet
'*
objRST.Sort = cRST
objRST.MoveFirst
'*
'* Build Table Heading
'*
Append "
Append ""
Append " Doc#
| "
Append " Description
| "
Append " PDF
| "
Append " HTML
| "
Append " TEXT
| "
Append "
"
'*
'* Read RecordSet
'*
Do While Not objRST.EOF
intRST = intRST + 1
strRST = Trim(objRST(cRST))
strPRE = Left(strRST,Len(strRST)-4)
strTXT = strPRE & ".txt"
'*
'* Description from tag
'*
strHTM = strPRE & "\index.html"
If objFSO.FileExists(strWWW & cFOL & strHTM) Then
Set objOTF = objFSO.OpenTextFile(strWWW & cFOL & strHTM,1)
strOTF = objOTF.ReadAll()
Set objOTF = Nothing
'*
strDSC = "?"
intDSC = InStr(strOTF,strTAG) + Len(strTAG)
If intDSC > 0 Then
strOTF = Mid(strOTF,intDSC)
intDSC = InStr(strOTF,Chr(34)) - 1
If intDSC > 0 Then
strDSC = Left(strOTF,intDSC)
End If
End If
End If
'*
'* Build Table Row
'*
Append ""
Append " " & strPRE & " | "
Append " " & strDSC & " | "
strLNK = ""
Append " " & strLNK & " | "
If strDSC <> "?" Then
strLNK = ""
Else
strLNK = ""
End If
Append " " & strLNK & " | "
If objFSO.FileExists(strWWW & cFOL & strTXT) Then
strLNK = ""
Else
strLNK = ""
End If
Append " " & strLNK & " | "
Append "
"
objRST.MoveNext
Loop
objRST.Close
Set objRST = Nothing
Append "
"
'*
'* Destroy Objects
'*
Set objFSO = Nothing
Sub Append(strSTR)
'***
'* Appends strings to array entries redimensioning as needed; (see
"Concat()").
'***
strSTR = strSTR & ""
If intSTR > UBound(arrSTR) Then
ReDim Preserve arrSTR(UBound(arrSTR) + 100)
End If
arrSTR(intSTR) = strSTR & vbCrLf
intSTR = intSTR + 1
End Sub
Function Concat()
'***
'* Concatenates array entries into a single string; (see "Append()").
'***
Redim Preserve arrSTR(intSTR)
Concat = Replace(Join(arrSTR, ""),"`",Chr(34))
Erase arrSTR
ReDim arrSTR(100)
intSTR = 0
End Function
%>
<%=cASP%>
<%=Concat%>
Re: It might be a database ...
am 14.01.2005 21:54:31 von Roland Hall
"Miles Archer" wrote in message
news:7C20442D-4901-4F08-BB08-655599EF50EF@microsoft.com...
:I will take a loook at it directly. I've been up all night, but I still
have
: a bit of steam.
Miles... what is the URL to your site?
Re: It might be a database ...
am 16.01.2005 07:59:03 von MilesArcher
"McKirahan" wrote:
> "Miles Archer" wrote in message
> > "McKirahan" wrote:
> >
> > > "Miles Archer" wrote in message
> > >
> > >
> > > [snip]
> >
> > >
> > > Given the above, do the following exist?
> > >
> > > c:\inetpub\wwwroot\documents\98-5634.PDF
> > > c:\inetpub\wwwroot\documents\98-5634.TXT
> > > c:\inetpub\wwwroot\documents\98-5634\index.html
> >
> > Yes. That is the way they exist.
> >
> >
> > > Is the Description you want the from each "index.html"?
> >
> > Well.. the is the name of the document, while the description is a
> > two sentence summary contained at
> content="fubar"> I
> > may have to do away with the description since it would be too large to
> put
> > in a table, unless I used really a small font or had it link to a new
> > description page. (A mouseover might work... I'll ahve to look into that
> > next.)
> >
> > > Is the "Doc#" column is a sequential number (001, 002, etc.) and not the
> > > document's fileame prefix? If the latter then what order do you want
> the
> > > filenames to be listed: alphabetically, by date, or?
> > >
> >
> > No, the Doc# is the filename's prefix. They are not sequential except for
> > small runs.
> > Alphabetical by filename prefix would be great.
> >
> > I really do appreciate all the time you are giving me.
>
> Try this and let me know. Watch for word-wrap.
>
> No file with the descriptions is need.
>
> <% @Language="VBScript"
> '*
> '* This ASP (Active Server Page) does the following:
> '* 1) Determines if folder "cFOL" exists.
> '* 2) Extracts the names of all PDF files in this folder.
> '* 3) Sort the PDF file names.
> '* 4) For each PDF file name build a row in an HTML table.
> '* 5) Displays this table in a Web page.
> '*
> '* The following is expected under "c:\wwwroot\inetpub\""
> '* 1) \documents\#.pdf
> '* 2) \documents\#.txt
> '* 3) \documents\#\index.html (meta tag contains description)
> '*
> '* Each row will contain a hyperlinked "X" if the file exists.
> '*
> Option Explicit
> '*
> '* Declare Constants
> '*
> Const cASP = "Doc.asp"
> Const cFOL = "documents\"
> Const cRST = "Doc"
> '*
> Const adChar = 129
> Const adLockBatchOptimistic = 4
> Const adOpenStatic = 3
> Const adUseClient = 3
> '*
> '* Declare Variables
> '*
> Dim arrBGC(1)
> arrBGC(0) = "#FFFFFF"
> arrBGC(1) = "#EEEEEE"
> Dim arrDOC
> Dim intDOC
> intDOC = 0
> Dim strDOC
> Dim intDSC
> Dim strDSC
> Dim strFIL
> Dim strHTM
> Dim strLNK
> Dim strOTF
> Dim strPRE
> Dim intRST
> Dim strRST
> Dim arrSTR()
> ReDim arrSTR(100)
> Dim intSTR
> intSTR = 0
> Dim strSTR
> Dim strTAG
> strTAG = "
> strTAG = Replace(strTAG,"`",Chr(34))
> Dim strTXT
> Dim strWWW
> strWWW = Request.ServerVariables("PATH_TRANSLATED")
> strWWW = Left(strWWW,InStrRev(strWWW,"\"))
> '*
> '* Declare Objects
> '*
> Dim objFSO
> Set objFSO = CreateObject("Scripting.FileSystemObject")
> If Not objFSO.FolderExists(strWWW & cFOL) Then Response.End
> Dim objGFO
> Dim objOTF
> Dim objRST
> Set objRST = CreateObject("ADODB.RecordSet")
> objRST.CursorLocation = adUseClient
> objRST.LockType = adLockBatchOptimistic
> objRST.CursorType = adOpenStatic
> objRST.ActiveConnection = Nothing
> objRST.Fields.Append cRST, adChar, 255
> objRST.Open
> '*
> '* Read File
> '*
> Set objGFO = objFSO.GetFolder(strWWW & cFOL)
> For Each strFIL in objGFO.Files
> If LCase(Right(strFIL.Name,4)) = ".pdf" Then
> objRST.AddNew
> objRST.Fields(cRST) = strFIL.Name
> objRST.Update
> End If
> Next
> Set objGFO = Nothing
> '*
> '* Sort RecordSet
> '*
> objRST.Sort = cRST
> objRST.MoveFirst
> '*
> '* Build Table Heading
> '*
> Append "
> Append ""
> Append " Doc#
| "
> Append " Description
| "
> Append " PDF
| "
> Append " HTML
| "
> Append " TEXT
| "
> Append "
"
> '*
> '* Read RecordSet
> '*
> Do While Not objRST.EOF
> intRST = intRST + 1
> strRST = Trim(objRST(cRST))
> strPRE = Left(strRST,Len(strRST)-4)
> strTXT = strPRE & ".txt"
> '*
> '* Description from tag
> '*
> strHTM = strPRE & "\index.html"
> If objFSO.FileExists(strWWW & cFOL & strHTM) Then
> Set objOTF = objFSO.OpenTextFile(strWWW & cFOL & strHTM,1)
> strOTF = objOTF.ReadAll()
> Set objOTF = Nothing
> '*
> strDSC = "?"
> intDSC = InStr(strOTF,strTAG) + Len(strTAG)
> If intDSC > 0 Then
> strOTF = Mid(strOTF,intDSC)
> intDSC = InStr(strOTF,Chr(34)) - 1
> If intDSC > 0 Then
> strDSC = Left(strOTF,intDSC)
> End If
> End If
> End If
> '*
> '* Build Table Row
> '*
> Append ""
> Append " " & strPRE & " | "
> Append " " & strDSC & " | "
> strLNK = ""
> Append " " & strLNK & " | "
> If strDSC <> "?" Then
> strLNK = ""
> Else
> strLNK = ""
> End If
> Append " " & strLNK & " | "
> If objFSO.FileExists(strWWW & cFOL & strTXT) Then
> strLNK = ""
> Else
> strLNK = ""
> End If
> Append " " & strLNK & " | "
> Append "
"
> objRST.MoveNext
> Loop
> objRST.Close
> Set objRST = Nothing
> Append "
"
> '*
> '* Destroy Objects
> '*
> Set objFSO = Nothing
>
> Sub Append(strSTR)
> '***
> '* Appends strings to array entries redimensioning as needed; (see
> "Concat()").
> '***
> strSTR = strSTR & ""
> If intSTR > UBound(arrSTR) Then
> ReDim Preserve arrSTR(UBound(arrSTR) + 100)
> End If
> arrSTR(intSTR) = strSTR & vbCrLf
> intSTR = intSTR + 1
> End Sub
>
> Function Concat()
> '***
> '* Concatenates array entries into a single string; (see "Append()").
> '***
> Redim Preserve arrSTR(intSTR)
> Concat = Replace(Join(arrSTR, ""),"`",Chr(34))
> Erase arrSTR
> ReDim arrSTR(100)
> intSTR = 0
> End Function
> %>
>
>
> <%=cASP%>
>
>
>
> <%=Concat%>
>
>
It's not working for me.
c:\wwwroot\inetpub\ isn't my root. it is c:\inetpub\wwwroot\, but I'm not
certain that's the problem - It's just a comment, right?
Browsing to c:\inetpub\wwwroot\ redirects me to http://localhost so perhaps
that's the problem.
I closed the line:
Append "
with:
Append ""
And I unwrapped:
'* Appends strings to array entries redimensioning as needed; (see
"Concat()").
But other than that, I am lost. I just get a 500 Internal Server Error. I
gave it a good 4 hours of tweaking with it for the last day, but I can't even
get a corrupt output to generate.
I have left you positive feedback with Microsoft, but I don't think we're
going to get this to work, unless you have a solution in mind.
I thank you for all the time and assistance you have provided.
Re: It might be a database ...
am 16.01.2005 14:37:32 von Roland Hall
"Miles Archer" wrote in message
news:30C0FB09-1168-4114-AA47-363AD6F763E9@microsoft.com...
: "McKirahan" wrote:
:
: > "Miles Archer" wrote in message
: > news:2E45CACC-6D3B-4EBF-9F09-0AD30D9C0DD4@microsoft.com...
: >
: > [snip]
:
: >
: > Given the above, do the following exist?
: >
: > c:\inetpub\wwwroot\documents\98-5634.PDF
: > c:\inetpub\wwwroot\documents\98-5634.TXT
: > c:\inetpub\wwwroot\documents\98-5634\index.html
:
: Yes. That is the way they exist.
That is not what you said previously. You said:
They are under a folder named 'documents', then the files are in a folder
that identifies them "98-5643", "04-9876", etc. Each folder has a matching
PDF and text file within that folder. ("98-5634.PDF", and "98-5634.TXT",
etc.
That implies
c:\inetpub\wwwroot\documents\98-5634\98-5634.PDF
c:\inetpub\wwwroot\documents\98-5634\98-5634.TXT
c:\inetpub\wwwroot\documents\98-5634\index.html
....which makes more sense. Why would these files be outside the directory
they relate to? So, which is correct?
--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp
Re: It might be a database ...
am 16.01.2005 18:55:02 von MilesArcher
"Roland Hall" wrote:
> "Miles Archer" wrote in message
> news:30C0FB09-1168-4114-AA47-363AD6F763E9@microsoft.com...
> : "McKirahan" wrote:
> :
> : > "Miles Archer" wrote in message
> : > news:2E45CACC-6D3B-4EBF-9F09-0AD30D9C0DD4@microsoft.com...
> : >
> : > [snip]
> :
> : >
> : > Given the above, do the following exist?
> : >
> : > c:\inetpub\wwwroot\documents\98-5634.PDF
> : > c:\inetpub\wwwroot\documents\98-5634.TXT
> : > c:\inetpub\wwwroot\documents\98-5634\index.html
> :
> : Yes. That is the way they exist.
>
> That is not what you said previously. You said:
> They are under a folder named 'documents', then the files are in a folder
> that identifies them "98-5643", "04-9876", etc. Each folder has a matching
> PDF and text file within that folder. ("98-5634.PDF", and "98-5634.TXT",
> etc.
>
> That implies
> c:\inetpub\wwwroot\documents\98-5634\98-5634.PDF
> c:\inetpub\wwwroot\documents\98-5634\98-5634.TXT
> c:\inetpub\wwwroot\documents\98-5634\index.html
>
> ....which makes more sense. Why would these files be outside the directory
> they relate to? So, which is correct?
>
> --
> Roland Hall
The PDF files _were_ outside the directory they relate to because the
program I use to create the HTML files creates folders with the document name
and puts the HTML files there, but leaves the PDF files where they were.
It takes all of two minutes to manipulate the *.pdf and *.txt files to place
them into or out of the appropriate folders.
Right now the PDF and Text files exist in AND out of the related files.
Once i have a solution that works I will delete the redundant files.
Re: It might be a database ...
am 16.01.2005 21:36:33 von McKirahan
"Miles Archer" wrote in message
news:377645B5-0500-4BCF-B801-381D462ACCE6@microsoft.com...
[snip]
> > '* The following is expected under "c:\wwwroot\inetpub\""
[snip]
> It's not working for me.
Can you be any more specific?
Insert "Reponse.Write" statements to see where it fails if you have no other
indication.
For example, increas # by 1 and place the following every few lines:
Response.Write #
Then run it and see what the highest number is.
Is the meta tag in each "index.html" file exactly like the following?
"
If the case is different then change the following from
intDSC = InStr(strOTF,strTAG) + Len(strTAG)
to
intDSC = InStr(LCase(strOTF),strTAG) + Len(strTAG)
> c:\wwwroot\inetpub\ isn't my root. it is c:\inetpub\wwwroot\, but I'm not
> certain that's the problem - It's just a comment, right?
Yes, it was a typo on my part.
>
> Browsing to c:\inetpub\wwwroot\ redirects me to http://localhost so
perhaps
> that's the problem.
>
> I closed the line:
> Append "
> with:
> Append ""
You were right to close it; don't know what happened my copy has it closed.
> And I unwrapped:
> '* Appends strings to array entries redimensioning as needed; (see
> "Concat()").
>
> But other than that, I am lost. I just get a 500 Internal Server Error. I
> gave it a good 4 hours of tweaking with it for the last day, but I can't
even
> get a corrupt output to generate.
Please verify that the page is in the folder above the "documents" folder
and that the following paths and relationships are still true:
c:\inetpub\wwwroot\documents\98-5634.PDF
c:\inetpub\wwwroot\documents\98-5634.TXT
c:\inetpub\wwwroot\documents\98-5634\index.html
>
> I have left you positive feedback with Microsoft, but I don't think we're
> going to get this to work, unless you have a solution in mind.
>
> I thank you for all the time and assistance you have provided.
An alternative is to convert this to a VBScript file and run it only when
new documents are added. The output would be a static HTML page (or just
"") that you could "include" or cut-and-paste.
Wait, I think I see it -- try changing all references of
CreateObject
to
Server.CreateObject
Let me know what happens.
Re: It might be a database ...
am 17.01.2005 06:43:01 von MilesArcher
We have lift-off! It is a thing of beauty. See below.
"McKirahan" wrote:
> "Miles Archer" wrote in message
> news:377645B5-0500-4BCF-B801-381D462ACCE6@microsoft.com...
>
> [snip]
>
> > > '* The following is expected under "c:\wwwroot\inetpub\""
>
> [snip]
>
> > It's not working for me.
>
> Can you be any more specific?
Just that it was a 500 error. I finally fired up Netscape and it gave me
better diagnostic information (more on that later).
As I started out saying, I don't use VBScript (until now). Is there a way
to get MSIE to display more info - Like what line of the script it finds
objectionable?
(I also have a Visual Basic Editor with debugging, but I am lost everytime I
fire it up - I need to find instructions for it.)
> Insert "Reponse.Write" statements to see where it fails if you have no other
> indication.
>
> For example, increas # by 1 and place the following every few lines:
> Response.Write #
> Then run it and see what the highest number is.
I wound up not needing to do this.
> Is the meta tag in each "index.html" file exactly like the following?
> "
>
> If the case is different then change the following from
> intDSC = InStr(strOTF,strTAG) + Len(strTAG)
> to
> intDSC = InStr(LCase(strOTF),strTAG) + Len(strTAG)
The case was as you wrote it (all lower).
> > c:\wwwroot\inetpub\ isn't my root. it is c:\inetpub\wwwroot\, but I'm not
> > certain that's the problem - It's just a comment, right?
>
> Yes, it was a typo on my part.
>
> >
> > Browsing to c:\inetpub\wwwroot\ redirects me to http://localhost so
> perhaps
> > that's the problem.
> >
> > I closed the line:
> > Append "
> > with:
> > Append ""
>
> You were right to close it; don't know what happened my copy has it closed.
>
>
> > And I unwrapped:
> > '* Appends strings to array entries redimensioning as needed; (see
> > "Concat()").
> >
> > But other than that, I am lost. I just get a 500 Internal Server Error. I
> > gave it a good 4 hours of tweaking with it for the last day, but I can't
> even
> > get a corrupt output to generate.
>
> Please verify that the page is in the folder above the "documents" folder
> and that the following paths and relationships are still true:
>
> c:\inetpub\wwwroot\documents\98-5634.PDF
> c:\inetpub\wwwroot\documents\98-5634.TXT
> c:\inetpub\wwwroot\documents\98-5634\index.html
Yes, that is where they were, but I had to move the PDF and Text documents
under the 98-5634 folder to make the script work.
Thus:
c:\inetpub\wwwroot\documents\98-5634\98-5634.PDF
c:\inetpub\wwwroot\documents\98-5634\98-5634.TXT
c:\inetpub\wwwroot\documents\98-5634\index.html
With the "script.asp" located at:
c:\inetpub\wwwroot\script.asp
Called up as:
http://localhost/script.asp
> > I have left you positive feedback with Microsoft, but I don't think we're
> > going to get this to work, unless you have a solution in mind.
> >
> > I thank you for all the time and assistance you have provided.
>
> An alternative is to convert this to a VBScript file and run it only when
> new documents are added. The output would be a static HTML page (or just
> "") that you could "include" or cut-and-paste.
I had already tried making it "file.vbs" and linking to it, but it had the
same errors.
> Wait, I think I see it -- try changing all references of
> CreateObject
> to
> Server.CreateObject
I found two instances of CreateObject. Using Server.CreateObject seems to
make no difference, even when the script functions properly.
> Let me know what happens.
Okay... I fired up Netscape and it told me "Invalid @ Command Directive"
which led me to the MS page:
http://support.microsoft.com/default.aspx?scid=KB;EN-US;Q246 828
I transformed:
<% @Language = "VBScript"
'* several comments
Option Explicit
Into:
<%@ Language = "VBScript" %>
'* several commennts
<% Option Explicit
That got me past the "Invalid @ command directive".
But generated:
Microsoft VBScript compilation error '800a0400'
Expected statement
/test.asp, line 17
Option Explicit
^
(Notice the caret at the 'O' in option)
So I removed your initial comments to get '<% Option Explicit' near the top
of the page to make troubleshooting easier.
Once I did that, I expected an error on line 2, but I didn't get it(?).
Instead I got:
Microsoft VBScript compilation error '800a0408'
Invalid character
/test2.asp, line 3
'*
^
(Notice the caret at the white space.)
So I thought that it didn't like any spaces, and I stripped your beautiful
script format of all spaces, which worked, but made a large-ish table with
funky shading. (usable)
But as I messed with the code more, I noticed that removing 3 of your spaces
and adding 3 spaces of my own (HTML view in FrontPage) put my cursor in a
different position than where it was originally(!?!).
So I guess FrontPage is a WYDSIWYG editor too ... (What you Don't see is
what you get) It must have something to do with ANSI/Unicode text being
pasted into it.
I usually use noteTAB lite for HTML and scripts, but FrontPage makes it
easier to manipulate those pages once they are created.
So I regrouped and made sure that the script text was in _plain_ text. That,
with a few modest corrections mentioned, did the trick. I'm sorry it took so
long for me to reply, but I wanted to make certain everything was in order
with the script.
I did a little reformatting and amended the comments. I changed:
Const cFOL = "documents\" into
Const cFOL = "documents/"
and
strHTM = strPRE & "\index.html" into
strHTM = strPRE & "/index.html" to make it more browser friendly.
When I figure out how to call it properly on Unix with Sun ONE Active Server
Pages I will post a link.
It's just missing one thing. A credit. Please tell me what you would like
displayed on the page.
Thank you so much.
Amended script below.
<% @Language="VBScript" %>
<% Option Explicit
'*
'* This ASP (Active Server Page) does the following:
'* 1) Determines if folder "cFOL" exists.
'* 2) Extracts the names of all PDF files in this folder.
'* 3) Sort the PDF file names.
'* 4) For each PDF file name build a row in an HTML table.
'* 5) Displays this table in a Web page.
'*
'* The following is expected under "c:\inetpub\wwwroot""
'* 1) \documents\#\#.pdf
'* 2) \documents\#\#.txt
'* 3) \documents\#\index.html (meta tag contains description)
'*
'* Each row will contain a hyperlinked "X" if the file exists.
'*
'*
'* Declare Constants
'*
Const cASP = "Doc.asp"
Const cFOL = "documents/"
Const cRST = "Doc"
'*
Const adChar = 129
Const adLockBatchOptimistic = 4
Const adOpenStatic = 3
Const adUseClient = 3
'*
'* Declare Variables
'*
Dim arrBGC(1)
arrBGC(0) = "#FFFFFF"
arrBGC(1) = "#EEEEEE"
Dim arrDOC
Dim intDOC
intDOC = 0
Dim strDOC
Dim intDSC
Dim strDSC
Dim strFIL
Dim strHTM
Dim strLNK
Dim strOTF
Dim strPRE
Dim intRST
Dim strRST
Dim arrSTR()
ReDim arrSTR(100)
Dim intSTR
intSTR = 0
Dim strSTR
Dim strTAG
strTAG = "
strTAG = Replace(strTAG,"`",Chr(34))
Dim strTXT
Dim strWWW
strWWW = Request.ServerVariables("PATH_TRANSLATED")
strWWW = Left(strWWW,InStrRev(strWWW,"\"))
'*
'* Declare Objects
'*
Dim objFSO
Set objFSO = CreateObject("Scripting.FileSystemObject")
If Not objFSO.FolderExists(strWWW & cFOL) Then Response.End
Dim objGFO
Dim objOTF
Dim objRST
Set objRST = CreateObject("ADODB.RecordSet")
objRST.CursorLocation = adUseClient
objRST.LockType = adLockBatchOptimistic
objRST.CursorType = adOpenStatic
objRST.ActiveConnection = Nothing
objRST.Fields.Append cRST, adChar, 255
objRST.Open
'*
'* Read File
'*
Set objGFO = objFSO.GetFolder(strWWW & cFOL)
For Each strFIL in objGFO.Files
If LCase(Right(strFIL.Name,4)) = ".pdf" Then
objRST.AddNew
objRST.Fields(cRST) = strFIL.Name
objRST.Update
End If
Next
Set objGFO = Nothing
'*
'* Sort RecordSet
'*
objRST.Sort = cRST
objRST.MoveFirst
'*
'* Build Table Heading
'*
Append ""
Append ""
Append " Doc#
| "
Append " Description
| "
Append " PDF
| "
Append " HTML
| "
Append " TEXT
| "
Append "
"
'*
'* Read RecordSet
'*
Do While Not objRST.EOF
intRST = intRST + 1
strRST = Trim(objRST(cRST))
strPRE = Left(strRST,Len(strRST)-4)
strTXT = strPRE & ".txt"
'*
'* Description from tag
'*
strHTM = strPRE & "/index.html"
If objFSO.FileExists(strWWW & cFOL & strHTM) Then
Set objOTF = objFSO.OpenTextFile(strWWW & cFOL & strHTM,1)
strOTF = objOTF.ReadAll()
Set objOTF = Nothing
'*
strDSC = "?"
intDSC = InStr(strOTF,strTAG) + Len(strTAG)
If intDSC > 0 Then
strOTF = Mid(strOTF,intDSC)
intDSC = InStr(strOTF,Chr(34)) - 1
If intDSC > 0 Then
strDSC = Left(strOTF,intDSC)
End If
End If
End If
'*
'* Build Table Row
'*
Append ""
Append " " & strPRE & " | "
Append " " & strDSC & " | "
strLNK = "
target='_blank'>X
"
Append " " & strLNK & " | "
If strDSC <> "?" Then
strLNK = "
target='_blank'>X
"
Else
strLNK = ""
End If
Append " " & strLNK & " | "
If objFSO.FileExists(strWWW & cFOL & strTXT) Then
strLNK = "
target='_blank'>X
"
Else
strLNK = ""
End If
Append " " & strLNK & " | "
Append "
"
objRST.MoveNext
Loop
objRST.Close
Set objRST = Nothing
Append "
"
'*
'* Destroy Objects
'*
Set objFSO = Nothing
Sub Append(strSTR)
'***
'* Appends strings to array entries redimensioning as needed; (see
"Concat()").
'***
strSTR = strSTR & ""
If intSTR > UBound(arrSTR) Then
ReDim Preserve arrSTR(UBound(arrSTR) + 100)
End If
arrSTR(intSTR) = strSTR & vbCrLf
intSTR = intSTR + 1
End Sub
Function Concat()
'***
'* Concatenates array entries into a single string; (see "Append()").
'***
Redim Preserve arrSTR(intSTR)
Concat = Replace(Join(arrSTR, ""),"`",Chr(34))
Erase arrSTR
ReDim arrSTR(100)
intSTR = 0
End Function
%>
<%=cASP%>
<%=Concat%>
Re: It might be a database ...
am 17.01.2005 19:15:53 von McKirahan
"Miles Archer" wrote in message
news:C9E26214-8A19-4396-A374-347F7DB80496@microsoft.com...
> We have lift-off! It is a thing of beauty. See below.
[snip]
> > Please verify that the page is in the folder above the "documents"
folder
> > and that the following paths and relationships are still true:
> >
> > c:\inetpub\wwwroot\documents\98-5634.PDF
> > c:\inetpub\wwwroot\documents\98-5634.TXT
> > c:\inetpub\wwwroot\documents\98-5634\index.html
>
> Yes, that is where they were, but I had to move the PDF and Text documents
> under the 98-5634 folder to make the script work.
> Thus:
> c:\inetpub\wwwroot\documents\98-5634\98-5634.PDF
> c:\inetpub\wwwroot\documents\98-5634\98-5634.TXT
> c:\inetpub\wwwroot\documents\98-5634\index.html
I used "cFOL" too many times.
If you want the files where you had them, try the amended script below.
> I found two instances of CreateObject. Using Server.CreateObject seems to
> make no difference, even when the script functions properly.
Since your ASP page runs on the server you should use
"Server.CreateObject()".
I added this line as an after thought
<%@ Language = "VBScript" %>
which out this line where it shouldn't be
<% Option Explicit
> So I guess FrontPage is a WYDSIWYG editor too ... (What you Don't see is
> what you get)
I hate FP and never use it!
> I did a little reformatting and amended the comments. I changed:
> Const cFOL = "documents\" into
> Const cFOL = "documents/"
> and
> strHTM = strPRE & "\index.html" into
> strHTM = strPRE & "/index.html" to make it more browser friendly.
You should really use "\" (not "/") in this case.
When refering to a URL use you "/" as in http://localhost/page.asp
When referenceing a file in the filesystem use "\" as in
"c:\inetpub\wwwroot\page.asp" -- as I'm doing.
> When I figure out how to call it properly on Unix with Sun ONE Active
Server
> Pages I will post a link.
>
> It's just missing one thing. A credit. Please tell me what you would like
> displayed on the page.
How about just or
> Thank you so much.
You're very welcome -- I like challenges.
[snip]
<%@ Language="VBScript" %>
<% Option Explicit
'****
'* This ASP (Active Server Page) does the following:
'* 1) Determines if folder "cFOL" exists.
'* 2) Extracts the names of all PDF files in this folder.
'* 3) Sort the PDF file names.
'* 4) For each PDF file name build a row in an HTML table.
'* 5) Displays this table in a Web page.
'*
'* The following is expected under "c:\inetpub\wwwroot\"
'* 1) \documents\#.pdf
'* 2) \documents\#.txt
'* 3) \documents\#\index.html (meta tag contains description)
'*
'* Each row will contain a hyperlinked "X" if the file exists.
'****
'*
'* Declare Constants
'*
Const cASP = "Doc.asp"
Const cFOL = "documents/"
Const cRST = "Doc"
'*
Const adChar = 129
Const adLockBatchOptimistic = 4
Const adOpenStatic = 3
Const adUseClient = 3
'*
'* Declare Variables
'*
Dim arrBGC(1)
arrBGC(0) = "#FFFFFF"
arrBGC(1) = "#EEEEEE"
Dim arrDOC
Dim intDOC
intDOC = 0
Dim strDOC
Dim intDSC
Dim strDSC
Dim strFIL
Dim strHTM
Dim strLNK
Dim strOTF
Dim strPRE
Dim intRST
Dim strRST
Dim arrSTR()
ReDim arrSTR(100)
Dim intSTR
intSTR = 0
Dim strSTR
Dim strTAG
strTAG = "
strTAG = Replace(strTAG,"`",Chr(34))
Dim strTXT
Dim strWWW
strWWW = Request.ServerVariables("PATH_TRANSLATED")
strWWW = Left(strWWW,InStrRev(strWWW,"\"))
'*
'* Declare Objects
'*
Dim objFSO
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
If Not objFSO.FolderExists(strWWW & cFOL) Then
Response.Write "
Path does not exist!
"
Response.End
End If
Dim objGFO
Dim objOTF
Dim objRST
Set objRST = Server.CreateObject("ADODB.RecordSet")
objRST.CursorLocation = adUseClient
objRST.LockType = adLockBatchOptimistic
objRST.CursorType = adOpenStatic
objRST.ActiveConnection = Nothing
objRST.Fields.Append cRST, adChar, 255
objRST.Open
'*
'* Read File
'*
Set objGFO = objFSO.GetFolder(strWWW)
For Each strFIL in objGFO.Files
If LCase(Right(strFIL.Name,4)) = ".pdf" Then
objRST.AddNew
objRST.Fields(cRST) = strFIL.Name
objRST.Update
End If
Next
Set objGFO = Nothing
'*
'* Sort RecordSet
'*
objRST.Sort = cRST
objRST.MoveFirst
'*
'* Build Table Heading
'*
Append ""
Append ""
Append " Doc#
| "
Append " Description
| "
Append " PDF
| "
Append " HTML
| "
Append " TEXT
| "
Append "
"
'*
'* Read RecordSet
'*
Do While Not objRST.EOF
intRST = intRST + 1
strRST = Trim(objRST(cRST))
strPRE = Left(strRST,Len(strRST)-4)
strTXT = strPRE & ".txt"
'*
'* Description from tag
'*
strHTM = strPRE & "\index.html"
If objFSO.FileExists(strWWW & cFOL & strHTM) Then
Set objOTF = objFSO.OpenTextFile(strWWW & cFOL & strHTM,1)
strOTF = objOTF.ReadAll()
Set objOTF = Nothing
'*
strDSC = "?"
intDSC = InStr(strOTF,strTAG) + Len(strTAG)
If intDSC > 0 Then
strOTF = Mid(strOTF,intDSC)
intDSC = InStr(strOTF,Chr(34)) - 1
If intDSC > 0 Then
strDSC = Left(strOTF,intDSC)
End If
End If
End If
'*
'* Build Table Row
'*
Append ""
Append " " & strPRE & " | "
Append " " & strDSC & " | "
strLNK = ""
Append " " & strLNK & " | "
If strDSC <> "?" Then
strLNK = ""
Else
strLNK = ""
End If
Append " " & strLNK & " | "
If objFSO.FileExists(strWWW & cFOL & strTXT) Then
strLNK = ""
Else
strLNK = ""
End If
Append " " & strLNK & " | "
Append "
"
objRST.MoveNext
Loop
objRST.Close
Set objRST = Nothing
Append "
"
'*
'* Destroy Objects
'*
Set objFSO = Nothing
Sub Append(strSTR)
'***
'* Appends strings to array entries ReDim as needed; (see "Concat()").
'***
strSTR = strSTR & ""
If intSTR > UBound(arrSTR) Then
ReDim Preserve arrSTR(UBound(arrSTR) + 100)
End If
arrSTR(intSTR) = strSTR & vbCrLf
intSTR = intSTR + 1
End Sub
Function Concat()
'***
'* Concatenates array entries into a single string; (see "Append()").
'***
Redim Preserve arrSTR(intSTR)
Concat = Replace(Join(arrSTR, ""),"`",Chr(34))
Erase arrSTR
ReDim arrSTR(100)
intSTR = 0
End Function
%>
<%=cASP%>
<%=Concat%>
Re: It might be a database ...
am 18.01.2005 00:33:03 von MilesArcher
"McKirahan" wrote:
> "Miles Archer" wrote in message
> > We have lift-off! It is a thing of beauty. See below.
>
> [snip]
>
> > > Please verify that the page is in the folder above the "documents"
> > > folder
> > > and that the following paths and relationships are still true:
> > >
> > > c:\inetpub\wwwroot\documents\98-5634.PDF
> > > c:\inetpub\wwwroot\documents\98-5634.TXT
> > > c:\inetpub\wwwroot\documents\98-5634\index.html
> >
> > Yes, that is where they were, but I had to move the PDF and Text documents
> > under the 98-5634 folder to make the script work.
> > Thus:
> > c:\inetpub\wwwroot\documents\98-5634\98-5634.PDF
> > c:\inetpub\wwwroot\documents\98-5634\98-5634.TXT
> > c:\inetpub\wwwroot\documents\98-5634\index.html
>
> I used "cFOL" too many times.
>
> If you want the files where you had them, try the amended script below.
It makes sense where it is now. But I'll try your amended script below anyway.
> > I found two instances of CreateObject. Using Server.CreateObject seems to
> > make no difference, even when the script functions properly.
>
> Since your ASP page runs on the server you should use
> "Server.CreateObject()".
I Server.CreateObject in use.
> I added this line as an after thought
> <%@ Language = "VBScript" %>
> which out this line where it shouldn't be
> <% Option Explicit
Yes, I noticed that there seemed to be a correlation between where <% Option
Explicit starts from the left hand side and how the code below it is
processed.
> > So I guess FrontPage is a WYDSIWYG editor too ... (What you Don't see is
> > what you get)
>
> I hate FP and never use it!
What do you use to manage and apply large site-wide changes? I have been
through several web editors, but that is what they do - edit; They tend to be
weak on managing.
Actually, I think the FP error was more a WinXP Pro problem than FP. When I
pasted your original post into Notepad, I used the default ANSI encoding to
save it and droped it into FP and changed the extension. There is also
Unicode, Unicode big endian(?), and UTF-8 encoding available in Notepad. I'm
not sure which to use, because I fired up NoteTAB lite and had no problems.
(I never had problems with Notepad on my trusty Win98 SE machine, so I don't
know WHAT is going on...)
> > I did a little reformatting and amended the comments. I changed:
> > Const cFOL = "documents\" into
> > Const cFOL = "documents/"
> > and
> > strHTM = strPRE & "\index.html" into
> > strHTM = strPRE & "/index.html" to make it more browser friendly.
>
> You should really use "\" (not "/") in this case.
>
> When refering to a URL use you "/" as in http://localhost/page.asp
>
> When referenceing a file in the filesystem use "\" as in
> "c:\inetpub\wwwroot\page.asp" -- as I'm doing.
I see your point, and it even occured to me as I was making the changes. But
the script resides on a server. What else would you use to generate a table
except a server and what else would you use to view a table on a server
except a browser? (I really don't know)
Without changing the slashes, the hyperlinks in the generated table were
http:\\localhost/98-5634/98-5634.PDF, which many browsers won't accept.
> > When I figure out how to call it properly on Unix with Sun ONE Active
> > Server Pages I will post a link.
I think I will end up creating the tables locally and pasting them into a
new page on the server. The script is "running" without errors on Linux w/Sun
ASP, but nothing dispalys except the HTML. The Sun ASP server is 2001
vintage, so I suspect some commands are different than expected - It's
probably killing the script in response to a command in the script.
> > It's just missing one thing. A credit. Please tell me what you would like
> > displayed on the page.
>
> How about just or
>
You got it!
> > Thank you so much.
>
> You're very welcome -- I like challenges.
I enjoy the challange too. I always get worried that the person on the
"other end" will give up before a solution is arrived at (whether I am giving
or getting advice). I would have kept at it another week at least. (I'm
going to try and add Word documents to it now that you have given me such an
excellent primer/starting point.)
Fair winds and following seas
(Best of luck, in Navy-eze)
Re: It might be a database ...
am 18.01.2005 00:43:25 von Roland Hall
"McKirahan" wrote in message news:P_SdnYQZK9IYnXHcRVn-sA@comcast.com...
: "Miles Archer" wrote in message
: news:C9E26214-8A19-4396-A374-347F7DB80496@microsoft.com...
: > We have lift-off! It is a thing of beauty. See below.
:
: > I found two instances of CreateObject. Using Server.CreateObject seems
to
: > make no difference, even when the script functions properly.
:
: Since your ASP page runs on the server you should use
: "Server.CreateObject()".
I thought using Server.CreateObject in lieu of CreateObject was due to MTS
being used. If not needed, Server.CreateObject would create unnecessary
overhead.
4Guys says:
http://www.4guysfromrolla.com/webtech/043099-1.shtml
But then Bernard Cheah (IIS MVP) says:
http://www.iis-resources.com/modules/newbb/viewtopic.php?top ic_id=2410&forum=10
Eric Lippert says:
http://blogs.msdn.com/ericlippert/archive/2004/06/01/145686. aspx
--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp
Re: It might be a database ...
am 18.01.2005 03:16:20 von McKirahan
"Miles Archer" wrote in message
news:F6FE6CFA-F79D-4D19-8F44-E0C0A49B04C9@microsoft.com...
[snip]
> What do you use to manage and apply large site-wide changes? I have been
> through several web editors, but that is what they do - edit; They tend to
be
> weak on managing.
Dreamweaver is popular.
[snip]
> > > I did a little reformatting and amended the comments. I changed:
> > > Const cFOL = "documents\" into
> > > Const cFOL = "documents/"
> > > and
> > > strHTM = strPRE & "\index.html" into
> > > strHTM = strPRE & "/index.html" to make it more browser friendly.
> >
> > You should really use "\" (not "/") in this case.
> >
> > When refering to a URL use you "/" as in http://localhost/page.asp
> >
> > When referenceing a file in the filesystem use "\" as in
> > "c:\inetpub\wwwroot\page.asp" -- as I'm doing.
>
> I see your point, and it even occured to me as I was making the changes.
But
> the script resides on a server. What else would you use to generate a
table
> except a server and what else would you use to view a table on a server
> except a browser? (I really don't know)
ASP runs on the server and FSO accesses the filesystem thus the use of "/"
amd "\" (respectively) is appropriate.
> Without changing the slashes, the hyperlinks in the generated table were
> http:\\localhost/98-5634/98-5634.PDF, which many browsers won't accept.
>
>
> > > When I figure out how to call it properly on Unix with Sun ONE Active
> > > Server Pages I will post a link.
>
> I think I will end up creating the tables locally and pasting them into a
> new page on the server. The script is "running" without errors on Linux
w/Sun
> ASP, but nothing dispalys except the HTML. The Sun ASP server is 2001
> vintage, so I suspect some commands are different than expected - It's
> probably killing the script in response to a command in the script.
You could "include" the resulting file in your ASP page via:
rather than cut-and-paste.
> > > It's just missing one thing. A credit. Please tell me what you would
like
> > > displayed on the page.
> >
> > How about just or
> >
>
> You got it!
>
> > > Thank you so much.
> >
> > You're very welcome -- I like challenges.
>
> I enjoy the challange too. I always get worried that the person on the
> "other end" will give up before a solution is arrived at (whether I am
giving
> or getting advice). I would have kept at it another week at least. (I'm
> going to try and add Word documents to it now that you have given me such
an
> excellent primer/starting point.)
>
> Fair winds and following seas
> (Best of luck, in Navy-eze)